//
// ABackground.cpp for bomberman in /home/lefebv_w//workspace/cpp/bomberman/googleCode/level
// 
// Made by damien lefebvre
// Login   <lefebv_w@epitech.net>
// 
// Started on  Sun May 12 16:33:54 2013 damien lefebvre
// Last update Mon May 27 20:16:30 2013 damien lefebvre
//

#include		"ABackground.hh"

void		ABackground::drawCube(Vector3f const & position, float size)
{
  glBegin(GL_QUADS);
	// Bottom Face
	glVertex3f(position.x, position.y, position.z);
	glVertex3f(position.x + size, position.y, position.z);
	glVertex3f(position.x + size, position.y + size, position.z);
	glVertex3f(position.x, position.y + size, position.z);
	
	
	// Side Faces
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(position.x, position.y, position.z);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(position.x + size, position.y, position.z);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(position.x + size, position.y, position.z + size);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(position.x, position.y, position.z + size);
	
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(position.x + size, position.y, position.z);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(position.x + size, position.y + size, position.z);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(position.x + size, position.y + size, position.z + size);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(position.x + size, position.y, position.z + size);
  
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(position.x + size, position.y + size, position.z);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(position.x, position.y + size, position.z);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(position.x, position.y + size, position.z + size);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(position.x + size, position.y + size, position.z + size);
 
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(position.x, position.y, position.z);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(position.x, position.y + size, position.z);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(position.x, position.y + size, position.z + size);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(position.x, position.y, position.z + size);

	// Top Face
	
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(position.x, position.y, position.z + size);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(position.x + size, position.y, position.z + size);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(position.x + size, position.y + size, position.z + size);
	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(position.x, position.y + size, position.z + size);
  glEnd();
}

void		ABackground::drawRectangle(Vector3f const & position, float size)
{  
  glBegin(GL_QUADS);

	glTexCoord2f(0.0f, 0.0f);
	glVertex3f(position.x, position.y, position.z);
	glTexCoord2f(0.0f, 1.0f);
	glVertex3f(position.x + size, position.y, position.z);
	glTexCoord2f(1.0f, 1.0f);
	glVertex3f(position.x + size, position.y + size, position.z);
	glTexCoord2f(1.0f, 0.0f);
	glVertex3f(position.x, position.y + size, position.z);
  glEnd();
}
